/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package core;

import model.Product;
import org.hibernate.Session;
import org.hibernate.Transaction;
import util.IsisHibernateUtil;

/**
 *
 * @author phinguyen
 */
public class Core {

    private static Session session;

    public Core() {
        session = IsisHibernateUtil.getSessionFactory().openSession();
    }

    /**
     *
     * @param product
     */
    public static void saveProduct(Product product) {
        Transaction tr = session.beginTransaction();
        session.saveOrUpdate(product);
        tr.commit();
    }
}
